<template>
	<!-- 设置 -->
	<view class="content">
		<view class="item" @click="toAccountsAndSecurity">
			<span>帐号与安全</span>
			<image src="/static/img/my_slices/Frame222@2x.png" mode=""></image>
		</view>
		<view class="item" @click="toMyContact">
			<span>我的联系方式</span>
			<image src="/static/img/my_slices/Frame222@2x.png" mode=""></image>
		</view>
		<view class="item" @click="toAboutUs">
			<span>关于我们</span>
			<image src="/static/img/my_slices/Frame222@2x.png" mode=""></image>
		</view>
		<view class="item" @click="toCancelAccount">
			<span>注销帐号</span>
			<image src="/static/img/my_slices/Frame222@2x.png" mode=""></image>
		</view>
		<button @click="loginout">退出登录</button>
		
		<view class="">
			<u-popup mode="center" :show="popupShow" round="12" :closeable="true" 
			@close="close" :closeOnClickOverlay="false">
				<view class="confirm">
					<span>是否确认退出登录？</span>
					<view class="check">
						<button @click="close">取消</button>
						<button @click="logout">确认</button>
					</view>
				</view>
			</u-popup>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				popupShow:false,		
			}
		},
		methods: {
			toAccountsAndSecurity(){
				//前往账号与安全
				uni.navigateTo({
					url:'./accountsAndSecurity/accountsAndSecurity'
				})
			},
			toMyContact(){
				//前往我的联系方式
				uni.navigateTo({
					url:'./myContact/myContact'
				})
			},
			toAboutUs(){
				//前往关于我们
				uni.navigateTo({
					url:'./aboutUs/aboutUs'
				})
			},
			toCancelAccount(){
				//前往注销账号
				uni.navigateTo({
					url:'./cancelAccount/cancelAccount'
				})
			},
			loginout(){
				//退出登录
				this.popupShow=true;
			},
			close(){
				this.popupShow=false;
			},
			logout() {
				uni.removeStorageSync('history')
				// this.$store.dispatch('initDic').then(()=>{
				// 	this.$http.request({
				// 		url:'/user/securityManage',
				// 		data:{
				// 			type:1,
				// 			pwd:rsaPassWord
				// 		}
				// 	}).then(result=>{
				// 		let res=result.data
				// 		console.log(res);
				// 		uni.showToast({
				// 			title: res.msg,
				// 			icon:'none'
				// 		})
				// 	})
				// })
				uni.removeStorage({
					key: 'token',
					success: function (res) {
						uni.showToast({
							title: '退出成功',
							icon: 'none'
						})
					}
				});
			},
		}
	}
</script>

<style scoped lang="scss">
	.content{
		width: 100%;
		min-height: 100vh;
		padding: 1px 0;
		background-color: #F3F7F8;
		
		.item{
			padding: 32rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 1px solid #F5F5F5;
			background-color: #FFFFFF;
			>span{
				font-size: 28rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #001A18;
			}
			>image{
				width: 16rpx;
				height: 30rpx;
			}
		}
		>button{
			display: flex;
			justify-content: center;
			align-items: center;
			width: 686rpx;
			height: 96rpx;
			margin: 32rpx;
			margin-top: 96rpx;
			background: #EDEDED;
			border-radius: 16rpx;
			font-size: 32rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #505E5C;
		}
		.confirm{
			width: 578rpx;
			height: 316rpx;
			background-color: #FFFFFF;
			border-radius: 24rpx;
			
			display: flex;
			flex-direction: column;
			align-items: center;
			
			>span{
				margin: 72rpx;
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #001A18;
			}
			
			.check{
				display: flex;
				>button{
					display: flex;
					justify-content: center;
					align-items: center;
					width: 242rpx;
					height: 96rpx;
					background: #F6F7F9;
					border-radius: 16rpx;
					
					font-size: 32rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #656565;
				}
				>button:nth-of-type(2){
					background: #08C8BD;
					color: #FFFFFF;
					margin-left: 30rpx;
				}
			}
		}
	}
</style>
